package com.aierjun.test.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.ImageView;

/**
 * Created by aierJun on 2016/12/16.
 */
public class AnimacationUtils {
    public static void myAnimacation(Context context,WebView webView, int animacation_id){
        Animation myAnimation = AnimationUtils.loadAnimation(context,animacation_id);
        webView.startAnimation(myAnimation);
    }
    public static void myAnimacation(Context context, ImageView webView, int animacation_id){
        Animation myAnimation = AnimationUtils.loadAnimation(context,animacation_id);
        webView.startAnimation(myAnimation);
    }

    /**
     * 截取webView可视区域的截图
     * @param webView 前提：WebView要设置webView.setDrawingCacheEnabled(true);
     * @return
     */
    public static Bitmap captureWebViewVisibleSize(WebView webView){
        Bitmap bmp = webView.getDrawingCache();
        return bmp;
    }
}
